package org.example.result;

import cn.hutool.http.HttpStatus;
import lombok.Data;

@Data
public class VividResult<T> {
    public int code;
    public Object data;
    public String msg;

    public VividResult(){}

    public VividResult(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public VividResult(String msg){
        this.msg = msg;
    }


    public VividResult(Object data,String msg){
        this.data = data;
        this.msg = msg;
    }

    public VividResult(int code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public static VividResult success(String msg,Object data){
        return new VividResult(HttpStatus.HTTP_OK,data,msg);
    }

    public static VividResult success(Object data){
        return new VividResult(HttpStatus.HTTP_OK,data,"操作成功！");
    }
    public static VividResult success(){
        return new VividResult(HttpStatus.HTTP_OK,"操作成功！");
    }

    public static VividResult warn(int code,String msg){
        return new VividResult(code,msg);
    }

    public static VividResult erro(){
        return new VividResult("操作失败！");
    }
}
